//
// Decompiled by Jadx - 397ms
//
package p;

import a.g;
import a.i;
import android.text.TextUtils;
import androidx.appcompat.app.t;
import fm.d;
import fn.b;
import fn.y;
import java.util.TimerTask;
import me.plusne.GreenDao.dao.ConfigSystemDao;
import me.plusne.common.Http.Hook;
import me.plusne.common.Json.JsonHookStatic;

public final class e extends TimerTask {
    public static int a;

    public static void b(b bVar, boolean z) {
        int i;
        int i2;
        if (z) {
            int i3 = b.b;
            JsonHookStatic jsonHookStatic = y.by;
            Object obj = jsonHookStatic.getSetListSys().get("queryHookDataTime");
            if (obj != null) {
                i = ((Integer) obj).intValue();
            } else {
                if (jsonHookStatic.getDb() != null) {
                    ConfigSystemDao configSystemDao = jsonHookStatic.getDb().r;
                    configSystemDao.getClass();
                    g gVar = new g(configSystemDao);
                    gVar.l(ConfigSystemDao.Properties.Key.f("queryHookDataTime"), new i[0]);
                    gVar.i(1);
                    d dVar = (d) gVar.k();
                    if (dVar != null && !TextUtils.isEmpty(dVar.c)) {
                        try {
                            i2 = Integer.parseInt(dVar.c);
                        } catch (NumberFormatException e) {
                            e.printStackTrace();
                        }
                    } else {
                        i2 = 0;
                    }
                    jsonHookStatic.getSetListSys().put("queryHookDataTime", Integer.valueOf(i2));
                    i = i2;
                }
                i = 0;
            }
            if (i + 5 > ((int) (System.currentTimeMillis() / 1000))) {
                return;
            }
        }
        JsonHookStatic jsonHookStatic2 = y.by;
        a aVar = new a(jsonHookStatic2.getActivity(), bVar);
        if (b.f(0, "queryHookDataTime") + 5 <= ((int) (System.currentTimeMillis() / 1000)) && jsonHookStatic2.getUserInfo() != null && !TextUtils.isEmpty(jsonHookStatic2.getUserInfo().getToken())) {
            t.c().j(((Hook) dq.b.b(Hook.class)).queryData().subscribeWith(aVar));
        }
    }

    @Override
    public final void run() {
        if (!y.by.isLogin()) {
            return;
        }
        b(null, true);
    }
}
